import { myRequest } from '@/util/api.js'


export function handleSignClick(){
	console.log(1)
}

export function getStoreInfo(sid)
{
  return myRequest('getStoreInfo/'+ sid,{}, 'GET');
}


export function getStoreSignSet(sid, staff_id)
{
 console.log("------------")
  var staff_id = uni.getStorageSync('staff_id')
  return myRequest('staffsign/noauth/getStoreSignSet/' + staff_id,{}, 'GET');
}
 /**
   * 保存预约
   * @param object data
   */
export function signSave(data) { 
    var staff_id = uni.getStorageSync('staff_id')
	return myRequest('staffsign/noauth/save', {staff_id: staff_id, type: data.type,  signinfo:JSON.stringify(data)}, 'POST', 1);
}
// 本地存储打卡信息
export function setSignInfo(info){
	var signInfo = {main:[info]}
	var jsonInfo = JSON.stringify(signInfo);
	uni.setStorageSync("signInfo",jsonInfo); 
	return signSave(info);//
}
// 本地添加打卡信息
export function addSignInfo(info,sign){
	sign.main.push(info);
	console.log("-----------------------")
	var jsonInfo = JSON.stringify(sign);
	uni.setStorageSync("signInfo",jsonInfo);
	return signSave(info);
}
// 本地获取打卡信息
export function getSignInfo(){
	let sign = uni.getStorageSync("signInfo");
	if(!sign){
		return;
	}
	return JSON.parse(sign)
}
// 本地打卡信息清理
export function delSignInfo(){
	uni.removeStorage({
		key: 'signInfo',
		success(){
			uni.showToast({title:"重置成功"})
		}
	});
}
// 打卡信息
export function getInfo(signInfo){
	var nowT = new Date();
	var info = {mode:signInfo.mode, type: signInfo.type,  nowT:nowT,address:signInfo.address,time:signInfo.time,latitude:signInfo.latitude,longitude:signInfo.longitude,remarks:signInfo.remarks};
	return info;
}

//获取  出差  签到 列表
export function netGetSignRecordList(data) {
	return myRequest('staffsign/signRecord',data, 'GET')
}
// 腾讯位置服务key 值
export const key = "MMABZ-NARCR-FG7WF-WUR6J-7C7S2-TAFMG";


